﻿using System;
using System . Collections . Generic;
using System . Linq;
using System . Text;
using System . Collections;
using System . Reflection;
using System . Xml . Linq;
using System . Xml . Serialization;
using System . Runtime . Serialization;
using System . Runtime;

using System . Threading . Tasks;

namespace WenceyWang . RichMan4L
{

	public abstract class GameObject : IDisposable
	{
		//Todo:如果没有别的用，删除这个。
		public static List<GameObject> GameObjectList { get; private set; } = new List<GameObject> ( );

		public long Index { get; set; }

		public abstract void EndToday ( );

		public abstract void StartDay ( Calendars . GameDate nextDate );

		public GameObject ( )
		{
			Index = GetHashCode ( );
			GameObjectList . Add ( this );
		}

		protected bool isSaving = false;

		#region IDisposable Support

		protected bool disposedValue = false; // To detect redundant calls

		protected virtual void Dispose ( bool disposing )
		{
			if ( !disposedValue )
			{
				if ( disposing )
				{
					GameObjectList . Remove ( this );

				}


				// TODO: set large fields to null.

				disposedValue = true;
			}
		}

		~GameObject ( )
		{
			Dispose ( false );
		}

		public void Dispose ( )
		{
			Dispose ( true );
		}
		#endregion

	}
}
